from utils.lon_lat_util import calculate_vehicle_corner_coordinates, calculate_easting_northing_velocity
from utils.utm_wgs84 import LLtoUTM

# 首先判断是否是车辆
if v_type == 1:
    size_length = float(4.5)
    size_width = float(2)
    size_height = float(1.7)
    subsType = int(3)
    # latitude、longitude proj 转化后背景车的经纬度 背景车的航向角
    corner1, corner2, corner3, corner4 = \
        calculate_vehicle_corner_coordinates(latitude, longitude, angle, 4.5, 2)
# 判断是否是行人
elif v_type == 4:
    size_length = float(0.5)
    size_width = float(0.5)
    size_height = float(1.75)
    subsType = int(10)
    corner1, corner2, corner3, corner4 = \
        calculate_vehicle_corner_coordinates(latitude, longitude, angle + 90, 1, 1)
x1, y1, zone_number, zone_letter = LLtoUTM(latitude, longitude)
corner1_x, corner1_y, corner1_zone_number, corner1_zone_letter = LLtoUTM(corner1[1], corner1[0])
corner2_x, corner2_y, corner2_zone_number, corner2_zone_letter = LLtoUTM(corner2[1], corner2[0])
corner3_x, corner3_y, corner3_zone_number, corner3_zone_letter = LLtoUTM(corner3[1], corner3[0])
corner4_x, corner4_y, corner4_zone_number, corner4_zone_letter = LLtoUTM(corner4[1], corner4[0])
# 背景车的速度，航向角
position_x = x1
position_y = y1
position_z = 0
vxabs, vyabs = calculate_easting_northing_velocity(speed, angle + 90)
polygon_points = [{"polygon_point_x": corner1_x, "polygon_point_y": corner1_y},
                  {"polygon_point_x": corner2_x, "polygon_point_y": corner2_y},
                  {"polygon_point_x": corner3_x, "polygon_point_y": corner3_y},
                  {"polygon_point_x": corner4_x, "polygon_point_y": corner4_y}]
polygon_point_length = len(polygon_points)

# 需要透传字段 size_length、size_width、size_height、subsType、position_x、position_y、position_z、
# vxabs、vyabs、polygon_points、polygon_point_length


